#include<iostream>

#include<string>

using namespace std;

     
string replaceSpace(string s)
{
    // write code here
    int space = 0;
    for (auto it : s)
    {
        if (it == ' ')
        {
            space++;
        }
    }
    int size = s.size();
    s.resize(s.size() + space * 2);
    auto new_end = s.end();
    new_end--;
    auto old_end = s.begin()+size-1;

    while (s.end() >= s.begin()&&new_end!=s.begin())
    {
        if (*old_end == ' ')
        {
            *new_end-- = '0';
            *new_end-- = '2';
            *new_end-- = '%';

        }
        else
        {
            *new_end = *old_end;
            new_end--;
        }

        old_end--;
    }
    return s;
}
bool idlong(string s)
{
	if (s.begin() < s.end())
		return true;
	else
	{
		return false;
	}
}
int main()
{
	string s;
	s += "We are happy";
	
	cout << s<<endl;
	//cout << idlong(s)<< endl;
    cout << replaceSpace(s) << endl;
	return 0;
}